home *** CD-ROM | disk | FTP | other *** search
- Member('DOSLIB')
- Eject('Program Identification Section')
- !
- ! ┌──────────────────────┐
- ! │Program Identification├──────────────────────────────────────────────────────
- ! └──────────────────────┘
- !
- ! Program Name : Doslib06.Cla
- ! Program Description : Allows Modification of Printer Control Codes
- ! Version : 1.00a
- ! Date : 02 Janurary 1994
- ! Programmer : Trevor G. Leybourne
- !
- ! ┌──────────────────────┐
- ! │Invocation Structure ├─────────────────────────────────────────────────────
- ! └──────────────────────┘
- !
- ! Functions Called : ListPrinters - Lists all Available Printers
- ! : EditPrinters - Allows Editing of Printers
- ! : ListControls - Lists all Available Controls
- ! : EditControls - Allows Editing of Sequences
- ! : ImportPrinters - Imports from Another File
- !
- ! ┌──────────────────────┐
- ! │Input/Output ├─────────────────────────────────────────────────────
- ! └──────────────────────┘
- !
- ! Datafiles Read : <Printers.CTL> - Printers File - ASCII Driver
- ! Datafiles Updated : <Printers.CTL> - Printers File - ASCII Driver
- !
- ! ┌──────────────────────┐
- ! ┌┤Functional Description├────────────────────────────────────────────────────┐
- ! │└──────────────────────┘ │
- ! │ │
- ! │ This program is based on the Clarion CDD Environment Printers Editor. │
- ! │ It allows the user to Load a Printer Control File, Change it and Write it │
- ! │ back. │
- ! └────────────────────────────────────────────────────────────────────────────┘
- !
- ! ┌──────────────────────┐
- ! ┌┤Modification History ├────────────────────────────────────────────────────┐
- ! │└──────────────────────┘ │
- ! │ Ver. Date Programmer Summary of Changes │
- ! ├────────────────────────────────────────────────────────────────────────────┤
- ! │ │
- ! │ 1.01 02-Jan-1994 Trevor G. Leybourne Original Production Version │
- ! │ │
- ! └────────────────────────────────────────────────────────────────────────────┘
- !
- Map
- ListPrinters
- EditPrinters
- ListControls
- EditControls
- LoadControls(Queue,Queue,Queue,Queue)
- SaveControls
- ImportPrinters
- .
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ Global Data Declarations ║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
- PrinterFilename String(64) ! Filename for PRINTER.CTL
- HighestPrinter Short ! Highest Printer Number
- HighestControl Short ! Highest Control Number
- ChangedFlag Byte(0) ! Anything been Changed Flag
- ActionMode1 Byte(0) ! Mode for Current Action (Printers)
- ActionMode2 Byte(0) ! Mode for Current Action (Controls)
- Action:Insert Equate(1) ! Inserting
- Action:Change Equate(2) ! Changing
- Action:Delete Equate(3) ! Deleting
-
- Printers Queue ! Queue of Printer Names
- Printers:Number Short ! Printer Number
- Printers:Name String(80) ! Name of the Printer
- . !
- Ports Queue ! Queue of Port Names
- Ports:Number Short ! Printer Number (Related)
- Ports:Name String(4) ! Port Name
- . !
- Controls Queue ! Queue of Control Name
- Controls:Number Short ! Control Number
- Controls:Name String(80) ! Control Name
- . !
- Sequences Queue ! Queue of Control Sequences
- Seq:Key Group ! Key into this Record
- Seq:Printer Short ! Printer Number
- Seq:Number Short ! Control Number
- . ! End of Key
- Seq:Sequence String(80) ! Control Sequence
- . !
- ControlSequence Queue ! Queue to Display in Main Table
- Ctl:Number Short ! Control Sequence Number
- Ctl:DisplayGroup Group
- Ctl:Name String(30) ! Display Control Name
- Ctl:BlankSpace String(' ') ! Blank Space
- Ctl:Sequence String(13) ! Display Control Sequence
- . .
- PrintersFile File,Create,Driver('ASCII'),Name(PrinterFileName)
- Record Record
- PrinterRecord String(80)
- . .
-
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ViewPrinters - Entry Point for the Procedure(s) ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- ViewPrinters Procedure(DefaultFileName)
-
- Code
- If Omitted(1) then
- PrinterFileName = GetFileDetails('PRINTER.CTL','Printer Control File','*.CTL')
- Else
- PrinterFileName = DefaultFileName
- .
- If Clip(PrinterFileName) = '' Then Return.
-
- LoadControls(Printers,Ports,Controls,Sequences)
-
- Get(Printers,Records(Printers))
- HighestPrinter = Printers:Number
- Get(Controls,Records(Controls))
- HighestControl = Controls:Number
-
- ChangedFlag = 0
- ListPrinters
- If ChangedFlag then SaveControls.
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ListPrinters - Lists the Printers on the Screen ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- ListPrinters Procedure
-
- Printers_List SCREEN(23,59),SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
- ROW(21,2) PAINT(1,1),COLOR(23)
- ROW(22,2) PAINT(1,1),COLOR(119)
- ROW(1,1) STRING('█{25}'),COLOR(3)
- COL(26) STRING('Printers'),COLOR(2)
- COL(34) STRING('█{26}'),COLOR(3)
- ROW(23,1) STRING('█▄{57}█'),COLOR(3)
- REPEAT(21)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,59) STRING('█'),COLOR(3)
- .
- File_Name ROW(3,4) STRING(@s53),COLOR(8)
- ROW(5,4) LIST(15,53),FROM(Printers:Name),HVSCROLL,USE(?Printers:Name),HIDE,COLOR(21,22,120)
- ROW(21,5) BUTTON(' I&mport '),SHADOW,USE(?Printers:Import),COLOR(17,18,39,19,20)
- COL(16) BUTTON(' &Insert '),SHADOW,KEY(InsKey),USE(?Printers:Insert),COLOR(17,18,39,19,20)
- COL(27) BUTTON(' &Change '),SHADOW,KEY(EnterKey),USE(?Printers:Change),COLOR(17,18,39,19,20)
- COL(38) BUTTON(' &Delete '),SHADOW,KEY(DelKey),USE(?Printers:Delete),COLOR(17,18,39,19,20)
- COL(49) BUTTON(' &Exit '),SHADOW,KEY(EscKey),USE(?Printers:Exit),COLOR(17,18,39,19,20)
- .
- Code
- Open(Printers_List)
- File_Name = Center(Clip(PrinterFileName),Size(File_Name))
- Loop
- Accept
- Get(Printers,Choice())
-
- Case Field()
- Of ?Printers:Name
- Of ?Printers:Import
- ImportPrinters
- Select(?Printers:Name,1)
- Of ?Printers:Insert
- ActionMode1 = Action:Insert
- Clear(Printers)
- Clear(Ports)
- EditPrinters
- Select(?Printers:Name)
- Of ?Printers:Change
- ActionMode1 = Action:Change
- EditPrinters
- Select(?Printers:Name)
- Of ?Printers:Delete
- ActionMode1 = Action:Delete
- EditPrinters
- Select(?Printers:Name)
- Of ?Printers:Exit
- Break
- . .
- Close(Printers_List)
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ EditPrinters - Allows Editing of the Printer Name/Port ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- EditPrinters Procedure
-
- Printers_Edit SCREEN(12,51),SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
- ROW(4,10) PAINT(1,5),COLOR(10)
- ROW(4,24) PAINT(1,5),COLOR(10)
- ROW(5,19) PAINT(4,1),COLOR(10)
- ROW(1,1) STRING('█{13}'),COLOR(3)
- COL(14) STRING('Add/Update Printer Model'),COLOR(31)
- COL(38) STRING('█{14}'),COLOR(3)
- ROW(12,1) STRING('█▄{49}█'),COLOR(3)
- REPEAT(10)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,51) STRING('█'),COLOR(3)
- .
- ROW(3,4) PROMPT('Name :'),COLOR(4,5,40,6,7)
- COL(10) ENTRY(@s40),USE(Printers:Name),COLOR(8,9,38)
- ROW(4,4) PROMPT('Port :'),COLOR(4,5,40,6,7)
- OPTION,USE(Ports:Name)
- COL(15) RADIO('NONE '),COLOR(15,16,37,41,42)
- ROW(5,10) RADIO('LPT1 '),COLOR(15,16,37,41,42)
- ROW(6,10) RADIO('LPT2 '),COLOR(15,16,37,41,42)
- ROW(7,10) RADIO('LPT3 '),COLOR(15,16,37,41,42)
- ROW(8,10) RADIO('LPT4 '),COLOR(15,16,37,41,42)
- ROW(5,20) RADIO('COM1 '),COLOR(15,16,37,41,42)
- ROW(6,20) RADIO('COM2 '),COLOR(15,16,37,41,42)
- ROW(7,20) RADIO('COM3 '),COLOR(15,16,37,41,42)
- ROW(8,20) RADIO('COM4 '),COLOR(15,16,37,41,42)
- .
- ROW(10,8) BUTTON(' Con&trols '),SHADOW,KEY(AltT),USE(?Ports:Controls),COLOR(17,18,39,19,20)
- COL(23) BUTTON(' &Ok '),SHADOW,KEY(EnterKey),USE(?Ports:Ok),COLOR(17,18,39,19,20)
- COL(34) BUTTON(' &Cancel '),SHADOW,KEY(EscKey),USE(?Ports:Cancel),COLOR(17,18,39,19,20)
- .
- Code
- Open(Printers_Edit)
- If ActionMode1 = Action:Delete then Disable(?Printers:Name,?Ports:Controls).
-
- Ports:Number = Printers:Number
- Get(Ports,Ports:Number)
- If Error() then
- Clear(Ports)
- PortAdd# = 1
- .
-
- Loop
- Display
- Accept
- Case Field()
- Of ?Printers:Name
- Of ?Ports:Controls
- ListControls
- Of ?Ports:Ok
- Case ActionMode1
- Of Action:Insert
- HighestPrinter = HighestPrinter + 1
- Printers:Number = HighestPrinter
- Add(Printers)
- Ports:Number = Printers:Number
- Add(Ports)
- Of Action:Change
- Put(Printers)
- If PortAdd# then
- Ports:Number = Printers:Number
- Add(Ports)
- Else
- Put(Ports)
- .
- Of Action:Delete
- Delete(Printers)
- Delete(Ports)
- .
- ChangedFlag = 1
- Break
- Of ?Ports:Cancel
- Break
- . .
- Close(Printers_Edit)
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ListControls - List the Printer Controls and Sequences ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- ListControls Procedure
-
- Controls_List SCREEN(16,59),SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
- ROW(1,1) STRING('█{17}'),COLOR(3)
- COL(18) STRING('Printer Control Sequences'),COLOR(31)
- COL(43) STRING('█{17}'),COLOR(3)
- ROW(16,1) STRING('█▄{57}█'),COLOR(3)
- REPEAT(14)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,59) STRING('█'),COLOR(3)
- .
- Printer_Name ROW(3,4) STRING(@s53),COLOR(8)
- ROW(5,4) LIST(8,53),FROM(Ctl:DisplayGroup),VSCROLL,USE(?Controls),HIDE,COLOR(21,22,68)
- ROW(14,9) BUTTON(' &Insert '),SHADOW,KEY(InsKey),USE(?Controls:Insert),COLOR(17,18,39,19,20)
- COL(20) BUTTON(' &Change '),SHADOW,KEY(EnterKey),USE(?Controls:Change),COLOR(17,18,39,19,20)
- COL(31) BUTTON(' &Delete '),SHADOW,KEY(DelKey),USE(?Controls:Delete),COLOR(17,18,39,19,20)
- COL(42) BUTTON(' &Exit '),SHADOW,KEY(EscKey),USE(?Controls:Exit),COLOR(17,18,39,19,20)
- .
- Code
- Do BuildCtlSequence
- Open(Controls_List)
- Printer_Name = Center(Clip(Printers:Name),Size(Printer_Name))
- Loop
- Display
- Accept
- Selected# = Choice()
- Get(ControlSequence,Selected#)
-
- Case Field()
- Of ?Controls
- Get(ControlSequence,Selected#)
- Of ?Controls:Insert
- ActionMode2 = Action:Insert
- EditControls
- Do BuildCtlSequence
- Display(?Controls)
- Select(?Controls,Selected#)
- Of ?Controls:Change
- ActionMode2 = Action:Change
- EditControls
- Do BuildCtlSequence
- Display(?Controls)
- Select(?Controls,Selected#)
- Of ?Controls:Delete
- ActionMode2 = Action:Delete
- EditControls
- Do BuildCtlSequence
- Display(?Controls)
- Select(?Controls,Selected#)
- Of ?Controls:Exit
- Break
- . .
- Close(Controls_List)
- Return
-
- BuildCtlSequence Routine
-
- Free(ControlSequence)
- Clear(ControlSequence)
- Loop Ptr# = 1 to Records(Controls)
- Get(Controls,Ptr#)
-
- Clear(Seq:Key)
- Seq:Printer = Printers:Number
- Seq:Number = Controls:Number
- Get(Sequences,Seq:Key)
- If Error() then Clear(Sequences).
-
- Ctl:Number = Controls:Number
- Ctl:Name = Controls:Name
- Ctl:Sequence = Seq:Sequence
- Add(ControlSequence)
- .
- Exit
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ EditControls - Allows Editing of the Control Sequences ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- EditControls Procedure
- ControlAdd Byte(0)
-
- Controls_Edit SCREEN(8,55),SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
- ROW(1,1) STRING('█{10}'),COLOR(3)
- COL(11) STRING('Add/Update Printer Control Sequence'),COLOR(31)
- COL(46) STRING('█{10}'),COLOR(3)
- ROW(8,1) STRING('█▄{53}█'),COLOR(3)
- REPEAT(6)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,55) STRING('█'),COLOR(3)
- .
- ROW(3,4) PROMPT('Name :'),COLOR(4,5,40,6,7)
- COL(12) ENTRY(@s40),USE(Controls:Name),COLOR(8,9,38)
- ROW(4,4) PROMPT('Con&trol:'),COLOR(4,5,40,6,7)
- COL(12) ENTRY(@s40),USE(Seq:Sequence),COLOR(8,9,38)
- ROW(6,15) BUTTON(' &Ok '),SHADOW,KEY(EnterKey),USE(?Sequence:Ok),COLOR(17,18,39,19,20)
- COL(33) BUTTON(' &Cancel '),SHADOW,KEY(EscKey),USE(?Sequence:Cancel),COLOR(17,18,39,19,20)
- .
- Code
- ControlAdd = False
-
- If ActionMode2 <> Action:Insert then
- Controls:Number = Ctl:Number
- Get(Controls,Controls:Number)
- If Error() then Clear(Controls); Beep.
-
- Clear(Sequences)
- Seq:Printer = Printers:Number
- Seq:Number = Controls:Number
- Get(Sequences,Seq:Key)
- If Error() then
- Clear(Sequences)
- ControlAdd = True
- . .
-
- Open(Controls_Edit)
- Enable(1,Fields())
- Case ActionMode2
- Of Action:Insert ;
- Of Action:Change ; Disable(?Controls:Name)
- Of Action:Delete ; Disable(?Controls:Name,?Seq:Sequence)
- .
-
- Loop
- Display
- Accept
- Case Field()
- Of ?Sequence:Ok
- Case ActionMode2
- Of Action:Insert
- HighestControl = HighestControl + 1
- Controls:Number = HighestControl
- Add(Controls)
-
- Seq:Printer = Printers:Number
- Seq:Number = Controls:Number
- Add(Sequences)
- Of Action:Change
- If ~ControlAdd then
- Put(Sequences)
- Else
- Seq:Printer = Printers:Number
- Seq:Number = Controls:Number
- Add(Sequences,Seq:Key)
- .
-
- Of Action:Delete
- Delete(Sequences)
- .
- ChangedFlag = 1
- Break
- Of ?Sequence:Cancel
- Break
- . .
- Close(Controls_Edit)
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ LoadControls - Loads the Controls File into Memory ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- LoadControls Procedure(Que:Printers,Que:Ports,Que:Controls,Que:Sequences)
- CurrentFlag Byte
- OverGroup1 Group
- Group:Number Short
- Group:Name String(80)
- .
- OverGroup2 Group
- Group:Number1 Short
- Group:Number2 Short
- Group:Name1 String(80)
- .
-
- LoadingScreen SCREEN(4,32),CENTER,SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
- ROW(3,5) PAINT(1,25),COLOR(8)
- ROW(1,1) STRING('█{8}'),COLOR(3)
- COL(9) STRING('Loading Printers'),COLOR(2)
- COL(25) STRING('█{8}'),COLOR(3)
- ROW(4,1) STRING('█▄{30}█'),COLOR(3)
- REPEAT(2)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,32) STRING('█'),COLOR(3)
- .
- REPEAT(1,25),INDEX(ShowIndx#)
- ShowPercentage ROW(3,4) STRING(@s1),COLOR(8)
- .
- .
-
- Code
- Open(LoadingScreen)
- Free(Que:Printers) ; Clear(Que:Printers)
- Free(Que:Controls) ; Clear(Que:Controls)
- Free(Que:Ports) ; Clear(Que:Ports)
- Free(Que:Sequences) ; Clear(Que:Sequences)
-
- Open(PrintersFile)
- If Error() then
- Close(LoadingScreen)
- .
-
- TotalBytes# = Bytes(PrintersFile)
- TotalCntr# = 0
- TotalRead# = 0
- LastCntr# = 1
-
- Set(PrintersFile,1)
- Loop
- Next(PrintersFile)
- If Error() then Break.
-
- TotalRead# += Bytes(PrintersFile)
- TotalCntr# = ((TotalRead# * 100) / TotalBytes#) / 4
- If TotalCntr# > LastCntr# then
- Loop ShowIndx# = LastCntr# to TotalCntr#
- ShowPercentage = '▒'
- .
- LastCntr# = TotalCntr#
- .
- If Clip(PrinterRecord) = '' then Cycle.
-
- Case Sub(Clip(Left(Upper(PrinterRecord))),1,9)
- Of 'PRINTERS '
- CurrentFlag = 1
- Of 'PORTS '
- CurrentFlag = 2
- Of 'CONTROLS '
- CurrentFlag = 3
- Of 'SEQUENCES'
- CurrentFlag = 4
- Else
- Case CurrentFlag
- Of 1
- Group:Number = Sub(PrinterRecord,1,Instring(' ',PrinterRecord,1)-1)
- Group:Name = Sub(PrinterRecord,Instring(' ',PrinterRecord,1)+1,80)
- Que:Printers = OverGroup1
- Add(Que:Printers)
- Of 2
- Group:Number = Sub(PrinterRecord,1,Instring(' ',PrinterRecord,1)-1)
- Group:Name = Sub(PrinterRecord,Instring(' ',PrinterRecord,1)+1,80)
- Que:Ports = OverGroup1
- Add(Que:Ports)
- Of 3
- Group:Number = Sub(PrinterRecord,1,Instring(' ',PrinterRecord,1)-1)
- Group:Name = Sub(PrinterRecord,Instring(' ',PrinterRecord,1)+1,80)
- Que:Controls = OverGroup1
- Add(Que:Controls)
- Of 4
- FirstPtr# = Instring(' ',PrinterRecord,1)
- SecondPtr# = Instring(' ',PrinterRecord,1,FirstPtr#+1)
-
- Group:Number1 = Sub(PrinterRecord,1,FirstPtr#-1)
- Group:Number2 = Sub(PrinterRecord,FirstPtr#+1,SecondPtr#-(FirstPtr#+1))
- Group:Name1 = Sub(PrinterRecord,SecondPtr#+1,80)
- Que:Sequences = OverGroup2
- Add(Que:Sequences)
- . . .
- Close(PrintersFile)
- Close(LoadingScreen)
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ SaveControls - Saves the Controls File from Memory ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- SaveControls Procedure
-
- Code
- Create(PrintersFile)
- If Error() then Stop('Error Creating Control File'); Return.
- Open(PrintersFile)
- If Error() then Stop('Error Openning Control File'); Return.
- !
- ! ----------------------------------------------------------
- ! Add the Printer Names to the Printers File
- ! ----------------------------------------------------------
- !
- PrinterRecord = 'PRINTERS'
- Add(PrintersFile)
- Loop Ptr# = 1 to Records(Printers)
- Get(Printers,Ptr#)
- PrinterRecord = Clip(Left(Format(Printers:Number,@n_3)))&' '&Printers:Name
- Add(PrintersFile)
- .
- !
- ! ----------------------------------------------------------
- ! Add the Printer Ports to the Printers File
- ! ----------------------------------------------------------
- !
- PrinterRecord = 'PORTS'
- Add(PrintersFile)
- Loop Ptr# = 1 to Records(Ports)
- Get(Ports,Ptr#)
- PrinterRecord = Clip(Left(Format(Ports:Number,@n_3)))&' '&Ports:Name
- Add(PrintersFile)
- .
- !
- ! ----------------------------------------------------------
- ! Add the Printer Control Names to the Printers File
- ! ----------------------------------------------------------
- !
- PrinterRecord = 'CONTROLS'
- Add(PrintersFile)
- Loop Ptr# = 1 to Records(Controls)
- Get(Controls,Ptr#)
- PrinterRecord = Clip(Left(Format(Controls:Number,@n_3)))&' '&Controls:Name
- Add(PrintersFile)
- .
- !
- ! ----------------------------------------------------------
- ! Add the Printer Control Sequences to the Printers File
- ! ----------------------------------------------------------
- !
- PrinterRecord = 'SEQUENCES'
- Add(PrintersFile)
- Loop Ptr# = 1 to Records(Sequences)
- Get(Sequences,Ptr#)
- PrinterRecord = Clip(Left(Format(Seq:Printer,@n_3)))&' '&Clip(Left(Format(Seq:Number,@n_3)))&' '&Seq:Sequence
- Add(PrintersFile)
- .
- Close(PrintersFile)
- Return
-
- OMIT('╝')
- ╔════════════════════════════════════════════════════════════════════════════╗
- ║ ImportPrinters - Imports Printers from Another Data File ║
- ╚════════════════════════════════════════════════════════════════════════════╝
- ImportPrinters Procedure
-
- ImportFileName String(64) ! Filename for Printers File
- Imp:Printers Queue ! Queue of Printer Names
- Imp:Printers:Number Short ! Printer Number
- Imp:Printers:Grp Group ! Display Group
- Imp:Printers:Name String(50) ! Name of the Printer
- Imp:Tagged String(1) ! Tagged?
- . . !
- Imp:Ports Queue ! Queue of Port Names
- Imp:Ports:Number Short ! Printer Number (Related)
- Imp:Ports:Name String(4) ! Port Name
- . !
- Imp:Controls Queue ! Queue of Control Name
- Imp:Controls:Number Short ! Control Number
- Imp:Controls:Name String(80) ! Control Name
- . !
- Imp:Sequences Queue ! Queue of Control Sequences
- Imp:Seq:Key Group ! Key into this Record
- Imp:Seq:Printer Short ! Printer Number
- Imp:Seq:Number Short ! Control Number
- . ! End of Key
- Imp:Seq:Sequence String(80) ! Control Sequence
- . !
-
- Printers_List SCREEN(23,63),SHADOW,CUA,COLOR(1)
- !dimensions=25,80,25,80
- !style=D:\CLARION\CLA_30\CLARION.STY
- ROW(21,3) PAINT(1,1),COLOR(23)
- ROW(1,1) STRING('█{24}'),COLOR(3)
- COL(25) STRING('Import Printers'),COLOR(2)
- COL(40) STRING('█{24}'),COLOR(3)
- ROW(23,1) STRING('█▄{61}█'),COLOR(3)
- REPEAT(21)
- ROW(2,1) STRING('█'),COLOR(3)
- ROW(2,63) STRING('█'),COLOR(3)
- .
- File_Name ROW(3,6) STRING(@s53),COLOR(8)
- ROW(5,6) LIST(15,53),FROM(Imp:Printers:Grp),HVSCROLL,USE(?Imp:Printers:Name),HIDE,COLOR(21,22,120)
- ROW(21,4) BUTTON(' &Mark '),SHADOW,KEY(EnterKey),USE(?Mark),COLOR(17,18,39,19,20)
- COL(12) BUTTON(' &Select All '),SHADOW,USE(?Select_All),COLOR(17,18,39,19,20)
- COL(26) BUTTON(' &De-Select All '),SHADOW,USE(?DeSelect_All),COLOR(17,18,39,19,20)
- COL(43) BUTTON(' &Import '),SHADOW,KEY(EnterKey),USE(?Ok),COLOR(17,18,39,19,20)
- COL(53) BUTTON(' &Cancel '),SHADOW,KEY(Esckey),USE(?ImportExit),COLOR(17,18,39,19,20)
- .
- Code
- ImportFileName = PrinterFileName
- PrinterFileName = GetFileDetails('','Import Control File','*.CTL')
- If Clip(PrinterFileName) = '' Then
- PrinterFileName = ImportFileName
- Return
- .
- Open(Printers_List)
- File_Name = Center(Clip(PrinterFileName),Size(File_Name))
- LoadControls(Imp:Printers,Imp:Ports,Imp:Controls,Imp:Sequences)
- PrinterFileName = ImportFileName
-
- Loop
- Accept
- Get(Imp:Printers,Choice())
- If Keycode() = MouseLeft2 then Press(EnterKey); Select(?Mark).
-
- Case Field()
- Of ?Imp:Printers:Name
- Of ?Mark
- If Imp:Tagged = '√' then
- Imp:Tagged = ' '
- Else
- Imp:Tagged = '√'
- .
- Put(Imp:Printers)
- Display(?Imp:Printers:Name)
- Select(?Imp:Printers:Name,Pointer(Imp:Printers))
- Of ?Select_All
- Loop Ptr# = 1 to Records(Imp:Printers)
- Get(Imp:Printers,Ptr#)
- Imp:Tagged = '√'
- Put(Imp:Printers)
- .
- Display(?Imp:Printers:Name)
- Select(?Imp:Printers:Name,Pointer(Imp:Printers))
- Of ?DeSelect_All
- Loop Ptr# = 1 to Records(Imp:Printers)
- Get(Imp:Printers,Ptr#)
- Imp:Tagged = ' '
- Put(Imp:Printers)
- .
- Display(?Imp:Printers:Name)
- Select(?Imp:Printers:Name,Pointer(Imp:Printers))
- Of ?Ok
- Do ImportNow
- Break
- Of ?ImportExit
- Break
- . .
- Close(Printers_List)
- Return
-
- ImportNow Routine
- !
- ! --------------------------------------------------------------
- ! Import the Control Sequence Numbers First
- ! --------------------------------------------------------------
- !
- Sort(Controls,Controls:Name)
- Loop Ptr# = 1 to Records(Imp:Controls)
- Get(Imp:Controls,Ptr#)
- Controls:Name = Imp:Controls:Name
- Get(Controls,Controls:Name)
- If Error() then
- HighestControl += 1
- Controls:Number = HighestControl
- Controls:Name = Imp:Controls:Name
- Add(Controls)
- . .
- Sort(Controls,Controls:Number)
- !
- ! --------------------------------------------------------------
- ! Import the Printer, Port and Sequence Details Next
- ! --------------------------------------------------------------
- !
- Loop Ptr# = 1 to Records(Imp:Printers)
- Get(Imp:Printers,Ptr#)
- If Imp:Tagged = '√' then
- Imp:Tagged = ' '
- Put(Imp:Printers)
- Select(?Imp:Printers:Name,Ptr#)
- Display(?Imp:Printers:Name)
-
- ChangedFlag = 1
- HighestPrinter += 1
- Clear(Printers)
- Printers:Name = Imp:Printers:Name
- Printers:Number = HighestPrinter
- Add(Printers)
- If Error() then Stop('Error Adding Printers Table').
-
- Imp:Ports:Number = Imp:Printers:Number
- Get(Imp:Ports,Imp:Ports:Number)
- If ~Error() then
- Ports:Number = Printers:Number
- Ports:Name = Imp:Ports:Name
- Add(Ports)
- If Error() then Stop('Error Adding Ports Table').
- .
-
- Imp:Seq:Printer = Imp:Printers:Number
- Get(Imp:Sequences,Imp:Seq:Printer)
- SeqPtr# = Pointer(Imp:Sequences)
- Loop
- Sequences = Imp:Sequences
- Seq:Printer = Printers:Number
-
- Imp:Controls:Number = Imp:Seq:Number
- Get(Imp:Controls,Imp:Controls:Number)
- Found# = 0
- Loop CtlPtr# = 1 to Records(Controls)
- Get(Controls,CtlPtr#)
- If Clip(Left(Upper(Controls:Name))) = Clip(Left(Upper(Imp:Controls:Name))) then
- Seq:Number = Controls:Number
- Found# = 1
- . .
- If ~Found# = 1 then
- Controls = Imp:Controls
- HighestControl += 1
- Controls:Number = HighestControl
- Add(Controls)
- Seq:Number = Controls:Number
- .
- Add(Sequences)
-
- SeqPtr# += 1
- Get(Imp:Sequences,Seq:Ptr#)
- If Error() or Imp:Seq:Printer <> Imp:Printers:Number then Break.
- . . .
- Free(Imp:Printers)
- Free(Imp:Controls)
- Free(Imp:Ports)
- Free(Imp:Sequences)
- Exit
-